package com.hhkj.study.api.order.controller;

import com.hhkj.study.api.order.model.req.ApiUserOrderListReq;
import com.hhkj.study.api.order.service.biz.ApiOrderBizService;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author luowu
 * @Date 2024/10/21 涵 9:01:23
 */
@RestController
@RequestMapping("/api/user/order")
public class ApiUserOrderController {


    @Resource
    private ApiOrderBizService orderBizService;

    /**
     * 订单列表
     * @param req
     * @return
     */
    @PostMapping("/list")
    public AjaxResult list(@Validated @RequestBody ApiUserOrderListReq req){
        return AjaxResult.success(orderBizService.list(req));
    }

    /**
     * 子订单详情
     * @param orderItemId
     * @return
     */
    @GetMapping("/{orderItemId}")
    public AjaxResult list(@PathVariable("orderItemId") Long orderItemId){
        return AjaxResult.success(orderBizService.get(orderItemId));
    }
}
